﻿using System;
using System.Collections.Generic;
using Smo = Microsoft.SqlServer.Management.Smo;

namespace SWSP.Management.ServerObjects
{
    public class SqlColumn : Column
    {
        #region Ctor

        public SqlColumn(string columnName, Smo.Table table)
            : base(columnName)
        {
            // Create database in memory
            _Column = table.Columns[this.Name];

            // Fill the properties
            FillProperties();
        }

        #endregion

        #region Private Properties

        private Smo.Column _Column;

        #endregion

        #region private Methods

        private void FillProperties()
        {
            this.Nullable = _Column.Nullable;
            this.Identity = _Column.Identity;
            this.DataType = _Column.DataType.Name;
        }

        #endregion
    }
}
